<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jQuerymini.js"></script>
    <!-- CSS only -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
</head>
 
<body>
    <button class="first">点击get请求</button>
    <button class="second">点击post请求</button>
    <button class="third">点击ajax请求</button>
    <script>
        $(function () {
            $('.first').on('click', function () {
                $.get('http://www.liulongbin.top:3006/api/getbooks', {
                    id: 1
                }, function (data) {
                    console.log(data);
                })
            })
            $('.second').on('click', function () {
                $.post('http://www.liulongbin.top:3006/api/addbook', {
                    id: 1
                }, function (data) {
                    console.log(data);
                })
            })
            $('.third').on('click', function () {
                $.ajax({
                    type: 'get',
                    url: 'http://www.liulongbin.top:3006/api/getbooks',
                    data: {
                        id: 1
                    },
                    success: function (res) {
                        console.log(res);
                    }
                })
            })
        })
    </script>
</body>

</html>